<?php
require_once '../sever/json.php';
require_once '../sever/dbhelper.php';


$str_search='';
if (!empty($_REQUEST['type'])){
    $type_id=$_REQUEST['type'];
    $str_search=" where type_id=$type_id";
}else{
    $str_search=" where type_id=(SELECT id FROM `news_type` WHERE state=1 LIMIT 1)";
}
$pdo=DB::getInstance()->connect();



$stmt=$pdo->query("select * from news".$str_search);
$data = $stmt->fetchAll(); //获取所有


Responce::json('200','succes',$data);